﻿//-----------------------------------------------------------------------
// <copyright file="DnsHelper.cs" company="SLWY Enterprises">
// * Copyright (C) 2017 四川商旅无忧科技有限公司 版权所有。
// * version : 1.0
// * author  : qinchaoyue
// * FileName: DnsHelper.cs
// * history : created by qinchaoyue 2017-11-27 03:56:41
// </copyright>
//-----------------------------------------------------------------------

namespace Slwy.Utility.Helper
{
    using System.Linq;
    using System.Net;
    using System.Net.Sockets;

    /// <summary>
    /// dns 帮助类
    /// </summary>
    public static class DnsHelper
    {
        /// <summary>
        /// 获取本机IP
        /// </summary>
        /// <returns>ip</returns>
        public static string GetIp()
        {
            return Dns.GetHostAddresses(Dns.GetHostName())
                .FirstOrDefault(m => m.AddressFamily == AddressFamily.InterNetwork)?.ToString();
        }
    }
}
